import { NativeModules } from 'react-native';

type OppoPushType = {
  init(isDebug: boolean): Promise<string>;
  isSupportPush(): Promise<boolean>;
  requestNotificationPermission(): void;
  openNotificationSettings(): void;
  register(appKey: string, appSecret: string, callback: Function): void;
  unRegister(): void;
};

type XiaomiPushType = {
  register(appId: string, appKey: string, callback: Function): void;
  unRegister(): void;
};

type HuaweiPushType = {
  register(appId: string, callback: Function): void;
  unRegister(appId: string): void;
};

type VivoPushType = {
  init(): Promise<number>;
  isSupportPush(): Promise<boolean>;
  register(callback: Function): void;
  unRegister(): Promise<number>;
}

const { OPPOPush, XIAOMIPush, HUAWEIPush, VIVOPush } = NativeModules;

const OppoPush = OPPOPush as OppoPushType;

const XiaomiPush = XIAOMIPush as XiaomiPushType;

const HuaweiPush = HUAWEIPush as HuaweiPushType;

const VivoPush = VIVOPush as VivoPushType;

export { OppoPush, XiaomiPush, HuaweiPush, VivoPush };
